menubutton: don't dereference NULL GdkEvent
authorCosimo Cecchi <cosimoc@gnome.org>
Fri, 29 Jun 2012 22:30:53 +0000 (18:30 -0400)
committerCosimo Cecchi <cosimoc@gnome.org>
Fri, 29 Jun 2012 22:30:53 +0000 (18:30 -0400)
Since we explictly call popup_menu with NULL when it's
keyboard-activated, we need to be careful and not access event->device
without checking for event != NULL before.

gtk/gtkmenubutton.c

index 4c1a2f1efb78f78f9b6153b45da634e60ad5c9ea..63bea8c824d86acde5b20f405cf6123f8052d391 100644 (file)
@@ -307,7 +307,9 @@ popup_menu (GtkMenuButton  *menu_button,
         break;
   }
 
-  gtk_menu_popup_for_device (GTK_MENU (priv->menu), event->device, NULL, NULL,
+  gtk_menu_popup_for_device (GTK_MENU (priv->menu),
+                             event ? event->device : NULL,
+                             NULL, NULL,
                              func,
                              GTK_WIDGET (menu_button),
                              NULL,